package com.easybuilder.common.api.service.impl;

import com.easybuilder.common.api.dao.SysRegionDao;
import com.easybuilder.common.api.entity.SysRegion;
import com.easybuilder.common.api.service.AddressService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {

    @Resource
    private SysRegionDao sysRegionDao;

    /** 获取指定等级的城市 */
    @Override
    public List<SysRegion> getAddressByLevel(Integer level) {
        SysRegion sysRegion = new SysRegion();
        sysRegion.setLevel(level);
        List<SysRegion> list = sysRegionDao.select(sysRegion);
        return list;
    }

    @Override
    public List<SysRegion> getChildrenByParentCode(Integer parentCode) {
        SysRegion sysRegion = new SysRegion();
        sysRegion.setParentCode(parentCode);
        List<SysRegion> list = sysRegionDao.select(sysRegion);
        return list;
    }
}
